// final class Person {
class Person {
    public Person() {
        System.out.println("Person 构造");
    }

    public void tell() {
        System.out.println("Person tell");
    }
}

/*** final 表示完结
 *   final声明类不能被继承
 *   final声明方法不能被重写
 *   final声明变量变成常量，常量是不可以被修改的
 * */

class Student extends Person {
    private String age = "34";

    public Student() {
        System.out.println("Student 构造1");
    }

    public Student(String age) {
        this.age = age;
        System.out.println("Student 构造2");
    }

    public void tell() {
//        super.tell();
        System.out.println("Student tell:" + this.age);
    }
}

abstract class WorksAbs {
    private String name;

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public abstract void tell();
}

class Works extends WorksAbs {
    public Works() {
    }

    public void tell() {
        System.out.println("tell name is: " + this.getName());
    }
}

/*** 接口
 * 多实现
 * 格式:
 * interface interfaceName {
 *     全局常量
 *     抽象方法
 * }
 * */
interface Inter {
    public final static String NAME = "接口常量";

    abstract public void tell();
}

interface Inter2 {
    abstract public void say();
}

interface Inter3 extends Inter, Inter2 {

}

abstract class Abs1 {
    abstract public void print();
}

class Demo extends Abs1 implements Inter3 {

    @Override
    public void tell() {
        System.out.println("tell name is:" + this.NAME);
    }

    @Override
    public void say() {
        System.out.println("say name is:" + this.NAME);
    }

    @Override
    public void print() {
        System.out.println("print name is:" + this.NAME);
    }
}

public class Main {

    public static void main(String[] args) {
//        System.out.println("Hello World!");
//        Student student = new Student();
//        student.tell();
//        Works works = new Works();
//        works.setName("张三");
//        works.tell();
        Demo demo = new Demo();
//        System.out.println(Inter.NAME);
//        demo.tell();
        demo.say();
//        demo.print();
    }
}
